<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // ES6中类的写法
       const Persion = class {
            constructor(name,age){// 构造方法函数，调用new，自动执行
            //    console.log(`构造函数执行了, ${name},${age}`);
                this.name = name;
                this.age = age;
            }
            showName(){
                return `名字为：${this.name}`
            }
            showAge(){
                return `年龄为：${this.age}`
            }
        }
        let p1 = new Persion('Strive', 18)
        console.log(p1.showAge(), p1.showName());
        
    </script>
</head>
<body>
    
</body>
</html>